package com.demo.spring_demo.mapper;

import com.demo.spring_demo.pojo.Song;
import com.demo.spring_demo.pojo.User;
import com.demo.spring_demo.pojo.UserAndUserInfo;
import org.apache.ibatis.annotations.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Mapper
@ResponseBody
public interface SongMapper {

    /**
     * 1、歌单入库(用来获取网上音源入库)
     * @param songList
     * @return
     */
    int addSongList(@Param("songList") List<Song> songList);



    /**
     * 2，添加歌曲
     * @param song
     * @return
     */
    @Insert("insert into song (id,songid,name,artist) values (null,#{songId},#{name},#{artist})")
    int addSong(Song song);

    /**
     * 3，修改歌曲
     * @param song
     * @return
     */
    @Update("update song set name=#{name},artist=#{artist} where songId=#{songId}")
    int updateSong(Song song);

    /**
     * 3、分页查询
     *  1、查询到的总条数
     *  2、查询到的数据
//     */
    int getCount(@Param("song") Song song);
    List<Song> getSong(@Param("song") Song song,@Param("index") int index,@Param("size") int size);

    /**
     * 4、删除用户
     * @param id
     * @return
     */
    @Delete("delete from song where id=#{id}")
    int deleteSong(int id);
}
